import java.util.List;
import java.util.ArrayList;


public class MethodEntityBlock extends EntityBlock {

	private Modifier modifier;
	private SimpleNode returnType;
	private List<EntityBlock> formals;
	private List<SimpleNode> statementNodes;
	private boolean isConstructor = false;

	public void setIsConstructor() {
		isConstructor = true;
	}

	public Modifier getModifier() {
		return modifier;
	}
	public void setModifier(Modifier modifier) {
		this.modifier = modifier;
	}

	public List<EntityBlock> getFormals() {
		return formals;
	}
	public void setFormals(List<EntityBlock> formals) {
		this.formals = formals;
	}

	public void setReturnType(SimpleNode returnType) {
		this.returnType = returnType;
	}
	public SimpleNode getReturnType() {
		return returnType;
	}

	public void setStatementNodes(List<SimpleNode> statementNodes) {
		this.statementNodes = statementNodes;
	}
	public List<SimpleNode> getStatementNodes() {
		return statementNodes;
	}

	public void print(String prefix) {
		if (isConstructor) {
			System.out.print(prefix + "Constructor_Declaration => Visibility:");
		} else {
			System.out.print(prefix + "Method_Declaration => Visibility:");
		}
		this.modifier.print(" ");
		System.out.print(" Return_Type: ");
		this.returnType.dump(" ");
		System.out.print(", Name: " + nameBlock.getName());
		super.print(prefix);
		if (returnType != null) {
			//returnType.dump(prefix + " ");
		}
		if (formals != null) {
			for (EntityBlock formal : formals) {
				formal.print(prefix + " ");
			}
		}
		if (statementNodes != null) {
			for (SimpleNode node : statementNodes) {
				node.dump(prefix + " ");
			}
		}
	}
}
